<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件通讯_父传子</title>
    <script src="./js/vue.js"></script>
    <style>
        .cls1 {
            border: 5px solid #000;
            padding: 10px;
        }
        .cls2 {
            border: 3px solid red;
            padding: 10px;
        }
    </style>
</head>
<body>
    <div id="app">
        <Father></Father>
    </div>
    <script>
        var Father = {
            data() {
                return {
                    value: "这是父组件向子组件传的数据"
                }
            },
            template: `
                <div class="cls1">
                    我是父组件
                    <br>
                    <Son v-bind:wangdong="value"></Son>
                </div>
            `
        }
        Vue.component("Son", {
            template: `
                <div class="cls2">
                    我是子组件  ---> {{ wangdong }}
                </div>
            `,
            props: ["wangdong"]
        })
        const app = new Vue({
            el: "#app",
            data: {

            },
            components: {
                Father
            }
        })
    </script>
</body>
</html>